﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;


namespace Bird.Data.Test
{
    [TestClass]
    public class SchemaTest
    {
        public void SetUp()
        {
            Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");

        } 
        protected string GetTestDbName()
        {
            string testDbName = "Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)) + @"\\Tests.Db.sdf;Persist Security Info=False";
            return testDbName;
        }
        [TestMethod]
        public void CanGenerateScript()
        {
            SetUp();
            Database.SetInitializer<BirdObjectContext>(null);
            BirdObjectContext dbContext = new Bird.Data.BirdObjectContext(GetTestDbName());
            Console.WriteLine("DbName:{0}", GetTestDbName());
            string script = dbContext.CreateDatabaseScript();
            Assert.IsNotNull(script);
            Console.WriteLine(script);
        }
    }
}
